
<?
$request = $_REQUEST['frame'];
if ($request == "students")
	$text = "&nbsp;&nbsp;&nbsp;Sinh viên";
$code = isset($_REQUEST['code']) ? $_REQUEST['code'] : 'pv';
if ($code == "khaigiang")		//cho phan khai giang
{?>
	<div class="timedetail"><?="Ngày ".date('d/m/Y')?></div>
	<div class="titledetail">Lịch khai giảng</div>
	<div class="content">
<?
	$code = "vn_".$code;
	$per_page =5;
	$p = isset ( $_GET["p"] ) ? intval ( $_GET["p"] ) : 0;
	$cWhere = " and parent = (select id from tbl_content_category where code='$code')";
	$sql = "select * from tbl_khaigiang where status=0 $cWhere order by ngaykg limit ".$per_page*$p.",".$per_page;
	//echo $sql;
	$result = @mysql_query($sql,$conn);
	$num=mysql_num_rows($result);
	if($num==0){?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr><td align="center"><font color="#FF0000" size="2">Thông tin đang cập nhật ...</font></td></tr>
	</table>
	<? }
	else{?>
	<? 
		$count = 0;
		while($row=mysql_fetch_assoc($result))
		{
			$count++;
			if ($count % 2 == 1) 
				$content_css = "athinklistbg";
			else
				$content_css = "athinklist";
		?>						  
			<div class="<?=$content_css?>">
				<div class="titlebn"><?=$row["title"]?></div>
				<ul>
					<li><strong align="justify">Thời gian: </strong><?=date('d.m.Y', strtotime($row["ngaykg"]))?></li>
					<li> <strong>Ca học:</strong> Thứ 2, 4, 6 </li>
					<li><strong align="justify">Địa điểm:</strong> <?=$row["venue"]?> </li>
					<li><strong>Thông tin chi tiết:</strong> <a href="./?frame=news_detail&id=<?=$row['id']?>">Download tại đây</a></li>
				</ul>
			</div>
		<? 
		}?>

	<? }
		echo "</div>";

	$total=countRecord("tbl_khaigiang","1=1 ".$cWhere);	//dem so luong record
	$number_of_page = ceil ( $total / $per_page );	//tong so trang
	//echo "so trang la:".$number_of_page;
	if ( $number_of_page > 0 )
	{
		$list_page = " <td> Trang $p / $number_of_page: </td>";
		
		$pre = "./?frame=".$_REQUEST['frame']."&code=faq&p=".($p-1);
		if ($p >=1 )	//neu trang hien tai nho hon 2 thi ko co' ve truoc nua
			$list_page .= "<a title='Trang trước' href='".$pre."'><img width='12' height='12' border='0' align='bottom' src='Images/FirstPage.gif'></a>";
		for ( $i = $p -1 ; $i <= $p + 1; $i++ )	//chi hien thi 3 trang lien ke
		{		
			//neu trang hien tai thi in dam
			if ( $i == $p )
			{
				$list_page .= "  <a href=''><font color='red'><b>".$i."</b></font></a>  ";
			}
			else	//khong phai trang hien tai
			{
				if ($i >= 0 && $i < $number_of_page)
					$list_page .= "<a href=\"./?frame=".$_REQUEST['frame']."&code=faq&p=$i\"> ".$i." </a>";
			}
			
		}
		$next = "./?frame=".$_REQUEST['frame']."&code=faq&p=".($p+1);
		if ($p < $number_of_page - 1)
			$list_page .= "<a title='Trang sau' href='".$next."'><img width='12' height='12' border='0' align='bottom' src='Images/LastPage.gif'></a>";
	}

print <<<EOF
<div class="pages">
{$list_page}
</div>
EOF;

		
	}
	else if ($code == "lichthi")
	{?>
		<div class="timedetail"><?="Ngày ".date('d/m/Y')?></div>
		<div class="titledetail">Lịch thi</div>
		<div class="content">
		<table class="tbstruct" width="100%" cellspacing="0" cellpadding="0" border="0">
			<tbody>
				<tr>
					<th class="bluem" width="6%" align="right">Ngày thi</th>
					<th class="bluem" width="63%">Môn thi</th>
					<th class="bluem" width="31%" nowrap="nowrap" align="center">Địa điểm</th>
				</tr>
	<?
		$code = "vn_".$code;
		$per_page =5;
		$p = isset ( $_GET["p"] ) ? intval ( $_GET["p"] ) : 0;
		$cWhere = " and parent = (select id from tbl_content_category where code='$code')";
		$sql = "select * from tbl_khaigiang where status=0 $cWhere order by ngaykg limit ".$per_page*$p.",".$per_page;
		//echo $sql;
		$result = @mysql_query($sql,$conn);
		$num=mysql_num_rows($result);
		if($num==0){?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr><td align="center"><font color="#FF0000" size="2">Thông tin đang cập nhật ...</font></td></tr>
		</table>
		<? }
		else{
			$count = 0;
			while($row=mysql_fetch_assoc($result))
			{
				$count++;
				if ($count % 2 == 1) 
					$ct_css = "blue";
				else
					$ct_css = "bluelight";
			?>
				<tr>
				  <td align="right" class="<?=$ct_css?>"><?=date('d.m.Y', strtotime($row['ngaykg']))?></td>
				  <td class="<?=$ct_css?>"><a href="./?frame=students&code=lichthi&kid=<?=$row['id']?>"><?=$row['title']?></a></td>
				  <td align="center" class="<?=$ct_css?>"><?=$row['venue']?></td>
				</tr>
			<? 
			}?>
			</tbody>
	   </table>
	<? }	?>
	</div>
<?
	$total=countRecord("tbl_khaigiang","1=1 ".$cWhere);	//dem so luong record
	$number_of_page = ceil ( $total / $per_page );	//tong so trang
	//echo "so trang la:".$number_of_page;
	if ( $number_of_page > 0 )
	{
		$list_page = " <td> Trang $p / $number_of_page: </td>";
		
		$pre = "./?frame=".$_REQUEST['frame']."&code=faq&p=".($p-1);
		if ($p >=1 )	//neu trang hien tai nho hon 2 thi ko co' ve truoc nua
			$list_page .= "<a title='Trang trước' href='".$pre."'><img width='12' height='12' border='0' align='bottom' src='Images/FirstPage.gif'></a>";
		for ( $i = $p -1 ; $i <= $p + 1; $i++ )	//chi hien thi 3 trang lien ke
		{		
			//neu trang hien tai thi in dam
			if ( $i == $p )
			{
				$list_page .= "  <a href=''><font color='red'><b>".$i."</b></font></a>  ";
			}
			else	//khong phai trang hien tai
			{
				if ($i >= 0 && $i < $number_of_page)
					$list_page .= "<a href=\"./?frame=".$_REQUEST['frame']."&code=faq&p=$i\"> ".$i." </a>";
			}
			
		}
		$next = "./?frame=".$_REQUEST['frame']."&code=faq&p=".($p+1);
		if ($p < $number_of_page - 1)
			$list_page .= "<a title='Trang sau' href='".$next."'><img width='12' height='12' border='0' align='bottom' src='Images/LastPage.gif'></a>";
	}

print <<<EOF
<div class="pages">
{$list_page}
</div>
EOF;

	?>
<?}
else if ($code != "stu_tttd" && $code != "stu_tnsv" && $code !=  "stu_tndn")
{
	$cWhere = "code = '$code'";
	
	$row = getRecord("tbl_content",$cWhere);
?>
	<div class="timedetail"><?=$text." - ".$row['date_added']?></div>
	<div class="titledetail"><?=$row['name']?></div>
	<div class="content">
		<?=$row['detail']?>
	</div>
<?
}
else if ($code == "stu_tttd")
{
	$code = "vn_".$code;
	$per_page =5;
	$p = isset ( $_GET["p"] ) ? intval ( $_GET["p"] ) : 0;
	$cWhere = " and parent = (select id from tbl_content_category where code='$code')";
	$sql = "select * from tbl_content where status=0 $cWhere order by sort,date_added desc limit ".$per_page*$p.",".$per_page;
	//echo $sql;
	$result = @mysql_query($sql,$conn);
	$num=mysql_num_rows($result);
?>
	<div class="timedetail">Ngày <?=date("d/m/Y")?></div>
	<div class="titledetail">Thông tin tuyển dụng</div>
	<div class="content">
<?
	if($num==0){?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr><td align="center"><font color="#FF0000" size="2">Thông tin đang cập nhật ...</font></td></tr>
	</table>
	<? }
	else{
	while($row=mysql_fetch_assoc($result))
	{
	?>
		<div class="anews">
				<div class="picdetailleft"><a href="./?frame=students&code=stu_tttd&id=<?=$row['id']?>"><img src="<?=$row['image']?>" width="90" height="90" border="0" /></a></div>
				<div class="title"><a href="./?frame=students&code=stu_tttd&id=<?=$row['id']?>"><?=$row['name']?></a></div>
		
					<?=$row['detail_short']?>
		</div><!--endNews-->
	<? 
	}?>
	  
	<? } ?>
	</div>
<?
	$total=countRecord("tbl_content","1=1 ".$cWhere);	//dem so luong record
	$number_of_page = ceil ( $total / $per_page );	//tong so trang
	//echo "so trang la:".$number_of_page;
	if ( $number_of_page > 0 )
	{
		$list_page = " <td> Trang $p / $number_of_page: </td>";
		
		$pre = "./?frame=".$_REQUEST['frame']."&code=faq&p=".($p-1);
		if ($p >=1 )	//neu trang hien tai nho hon 2 thi ko co' ve truoc nua
			$list_page .= "<a title='Trang trước' href='".$pre."'><img width='12' height='12' border='0' align='bottom' src='Images/FirstPage.gif'></a>";
		for ( $i = $p -1 ; $i <= $p + 1; $i++ )	//chi hien thi 3 trang lien ke
		{		
			//neu trang hien tai thi in dam
			if ( $i == $p )
			{
				$list_page .= "  <a href=''><font color='red'><b>".$i."</b></font></a>  ";
			}
			else	//khong phai trang hien tai
			{
				if ($i >= 0 && $i < $number_of_page)
					$list_page .= "<a href=\"./?frame=".$_REQUEST['frame']."&code=faq&p=$i\"> ".$i." </a>";
			}
			
		}
		$next = "./?frame=".$_REQUEST['frame']."&code=faq&p=".($p+1);
		if ($p < $number_of_page - 1)
			$list_page .= "<a title='Trang sau' href='".$next."'><img width='12' height='12' border='0' align='bottom' src='Images/LastPage.gif'></a>";
	}

print <<<EOF
<div class="pages">
{$list_page}
</div>
EOF;

	?>
<?}
else if($code == "stu_tnsv" || $code ==  "stu_tndn")
{
	if ($code == "stu_tnsv")
		$text = "Tiếng nói sinh viên";
	else
		$text = "Tiếng nói doanh nghiệp";
	$code = "vn_".$code;
	$per_page =5;
	$p = isset ( $_GET["p"] ) ? intval ( $_GET["p"] ) : 0; 
	
	$cWhere = " and parent = (select id from tbl_content_category where code='$code')";
	$sql = "select * from tbl_content where status=0 $cWhere order by sort,date_added desc limit ".$per_page*$p.",".$per_page;
	//echo $sql;
	$result = @mysql_query($sql,$conn);
	$num=mysql_num_rows($result);
?>
	<div class="timedetail">Ngày <?=date("d/m/Y")?></div>
	<div class="titledetail"><?=$text?></div>
	<div class="content">
<?
	if($num==0){?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr><td align="center"><font color="#FF0000" size="2">Thông tin đang cập nhật ...</font></td></tr>
	</table>
	<? }
	else{
	$count = 0;
	while($row=mysql_fetch_assoc($result))
	{
		$count++;
		if ($count % 2 == 1)
			$data_style = "athinklistbg";
		else
			$data_style = "athinklist";
	?>
		<div class="<?=$data_style?>">
			<div class="titlebn"><?=$count.". ".$row['name']?></div>
			<div class="time"><?=$row['date_added']?></div>
			<?=$row['detail']?>
        </div>
	<? 
	}?>
	  
	<? } ?>
	</div>
			<?
	$total=countRecord("tbl_content","1=1 ".$cWhere);	//dem so luong record
	$number_of_page = ceil ( $total / $per_page );	//tong so trang
	//echo "so trang la:".$number_of_page;
	if ( $number_of_page > 0 )
	{
		$list_page = " <td> Trang $p / $number_of_page: </td>";
		
		$pre = "./?frame=".$_REQUEST['frame']."&code=".$code."&p=".($p-1);
		if ($p >=1 )	//neu trang hien tai nho hon 2 thi ko co' ve truoc nua
			$list_page .= "<a title='Trang trước' href='".$pre."'><img width='12' height='12' border='0' align='bottom' src='Images/FirstPage.gif'></a>";
		for ( $i = $p -1 ; $i <= $p + 1; $i++ )	//chi hien thi 3 trang lien ke
		{		
			//neu trang hien tai thi in dam
			if ( $i == $p )
			{
				$list_page .= "  <a href=''><font color='red'><b>".$i."</b></font></a>  ";
			}
			else	//khong phai trang hien tai
			{
				if ($i >= 0 && $i < $number_of_page)
					$list_page .= "<a href=\"./?frame=".$_REQUEST['frame']."&code=".$code."&p=$i\"> ".$i." </a>";
			}
			
		}
		$next = "./?frame=".$_REQUEST['frame']."&code=".$code."&p=".($p+1);
		if ($p < $number_of_page - 1)
			$list_page .= "<a title='Trang sau' href='".$next."'><img width='12' height='12' border='0' align='bottom' src='Images/LastPage.gif'></a>";
	}

print <<<EOF
<div class="pages">
{$list_page}
</div>
EOF;

	?>
<?}?>